//
//  M_MyComment.m
//  suRead
//
//  Created by 李 诗洋 on 16/1/5.
//  Copyright © 2016年 bao. All rights reserved.
//

#import "M_MyComment.h"

@implementation M_MyComment

+ (NSDictionary *)JSONKeyPathsByPropertyKey
{
    return @{
             @"f_commentid": @"commentid",
             @"f_content": @"content",
             @"f_creat_at": @"creat_at",
             @"f_id": @"id",
             @"f_userid": @"userid",
             @"f_username": @"username",
             @"f_ip":@"ip",
             @"f_direction":@"direction",
             @"f_reply":@"reply",
             @"f_siteid":@"siteid",
             @"f_status":@"status",
             @"f_support":@"support",
             @"f_title":@"title"
             };
}

+ (NSValueTransformer *)f_creat_atJSONTransformer {
        
        return [MTLValueTransformer transformerUsingForwardBlock:^(NSNumber *value_, BOOL *success, NSError **error){
            
            if (!value_) {
                return @"";
            }
            
            double timeInterval = [value_ doubleValue];
            NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
            [formatter setDateStyle:NSDateFormatterMediumStyle];
            [formatter setTimeStyle:NSDateFormatterShortStyle];
            [formatter setDateFormat:@"MM-dd HH:mm"];
            
            //时间戳转时间的方法
            NSDate *confromTimesp = [NSDate dateWithTimeIntervalSince1970:timeInterval];
            NSString *confromTimespStr = [formatter stringFromDate:confromTimesp];
            
            return confromTimespStr;
            
        }];
        
    }


@end
